//
//  JAStatusCell.swift
//  JAWeiBo
//
//  Created by Arvin on 17/4/6.
//  Copyright © 2017年 Arvin. All rights reserved.
//

import UIKit

class JAStatusCell: UITableViewCell {
    
    ///微博的数据模型
    var statusViewModel: JAStatusViewModel? {
        didSet {
            
            originalView.statusViewModel = statusViewModel
        }
    }
    

    ///原创微博部分
    lazy var originalView: JAOriginalStatusView = JAOriginalStatusView()
    
    ///转发微博部分
    lazy var retweetedView: JARetweetedStatusView = JARetweetedStatusView()
    
    ///cell底部的bar
    lazy var toolBar: JAStatusToolBar = JAStatusToolBar()
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        //隐藏分隔线
        self.selectionStyle = .none
        
        setupUI()
    }
    
   required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
   
}

// MARK: - 设置UI
extension JAStatusCell {
    func setupUI () {
        
        //设置颜色
        self.contentView.backgroundColor = home_CellColor
        originalView.backgroundColor = UIColor.white
        
        //添加子视图
        self.contentView.addSubview(originalView)
        self.contentView.addSubview(toolBar)
        
        //添加约束
        originalView.snp.makeConstraints { (make) in
            make.top.equalTo(self.contentView).offset(5)
            make.left.right.equalTo(self.contentView)
            
        }
        
        toolBar.snp.makeConstraints { (make) in
            make.top.equalTo(originalView.snp.bottom)
            make.left.bottom.right.equalTo(self.contentView)
            make.height.equalTo(36)
            
        }

        
    }
}
